//Component Object
const app = getApp();

Component({
  data: {
    colorTheme: app.globalData.colorTheme
  },
  properties: {
    postList:{
      type:Array,
      value:[]
    },
  },
  methods: {
    // 点赞帖子或取消点赞帖子
    likeOrunLikePost(e){
      this.triggerEvent('dolike', { postId: e.currentTarget.dataset.postid})
    },
    // 跳转到帖子详情页
    toPostInfo(e){
      this.triggerEvent('topost', { 
        postId: e.currentTarget.dataset.postid,
        jump: e.currentTarget.dataset.jump
      })
    },
    // 预览图片
    viewImage(e){
      this.triggerEvent('viewimg', { 
        postIndex: e.currentTarget.dataset.postindex,
        imgIndex: e.currentTarget.dataset.imgindex
      })
    }
  },
  options: {
    addGlobalClass: true
  }
});